<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/vue.js"></script>
</head>
<body>

<div id="app">
    <input type="text" v-model="inputVal">
    <button v-on:click="pushText">提交</button>
    <ul>
        <todo-list v-bind:item="item" v-for="item in content"></todo-list>
    </ul>
</div>
</body>
<script>

    // // 注册全局的组件
    // Vue.component("TodoList",{
    //     props:['item'],
    //     template:"<li>{{item}}</li>"
    // })


    // 局部组件注册
    var TodoList={
        props:['item'],
        template:"<li>{{item}}</li>"
    }

    var vue = new Vue({
        el: "#app",
        components:{
            TodoList:TodoList
        },
        data: {
            content:[],
        }, methods: {
            pushText: function () {
                this.$data.content.push(this.inputVal);
                this.inputVal="";
            }
        }
    })


</script>
</html>